package com.example.administrator.maizuofilm.main.fragment.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.example.administrator.maizuofilm.BaseFragment;
import com.example.administrator.maizuofilm.R;
import com.example.administrator.maizuofilm.bean.Active;
import com.example.administrator.maizuofilm.main.fragment.BaGuaActivity;
import com.example.administrator.maizuofilm.main.fragment.ChaoZhiActivity;
import com.example.administrator.maizuofilm.main.fragment.PinTuanActivity;
import com.example.administrator.maizuofilm.main.fragment.SaoActivity;
import com.example.administrator.maizuofilm.main.fragment.XianshiActivity;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/7/13.
 */
public class ActiveFragment extends BaseFragment implements ActiveContract.View {
    @InjectView(R.id.iv_saomiao)
    ImageView ivSaomiao;
    @InjectView(R.id.linear_xianshi)
    LinearLayout linearXianshi;
    @InjectView(R.id.linear_chaozhi)
    LinearLayout linearChaozhi;
    @InjectView(R.id.linear_pintuan)
    LinearLayout linearPintuan;
    @InjectView(R.id.linear_bagua)
    LinearLayout linearBagua;
    @InjectView(R.id.recyclerview)
    RecyclerView recyclerView;
    private ActivePresenter mPresenter;
    private ActiveModel mModel;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_active, null);
        ButterKnife.inject(this, view);
        mModel  = new ActiveModel();
        mPresenter = new ActivePresenter(this,mModel);
        mPresenter.init();
        return view;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }

    @OnClick({R.id.iv_saomiao, R.id.linear_xianshi, R.id.linear_chaozhi, R.id.linear_pintuan, R.id.linear_bagua, R.id.recyclerview})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_saomiao:
                Intent intent= new Intent();
                intent.setClass(getActivity(),SaoActivity.class);
                startActivity(intent);
                break;
            case R.id.linear_xianshi:
                Intent intent1=new Intent();
                intent1.setClass(getActivity(),XianshiActivity.class);
                startActivity(intent1);
                break;
            case R.id.linear_chaozhi:
                Intent intent2=new Intent();
                intent2.setClass(getActivity(),ChaoZhiActivity.class);
                startActivity(intent2);
                break;
            case R.id.linear_pintuan:
                Intent intent3= new Intent();
                intent3.setClass(getActivity(),PinTuanActivity.class);
                startActivity(intent3);
                break;
            case R.id.linear_bagua:
                Intent intent4=new Intent();
                intent4.setClass(getActivity(),BaGuaActivity.class);
                startActivity(intent4);
                break;
            case R.id.recyclerview:
                break;
        }
    }

    @Override
    public void onInitSuccess(Active active) {

    }

    @Override
    public void onInitFail() {

    }
}
